In general, there are two primary ways for a company to raise capital: by selling debt, such as bonds, and by selling equity, such as stocks. An advantage of debt is that the interest that a company pays to the bond holder is tax deductible. Accordingly, debt would at least superficially appear to cost a company less than equity.
However, this naïve view is not borne out in practice because, from the issuing company's perspective, debt incurs a larger cost of risk (e.g., for liquidity risk) than equity. A company generally must pay out on its bonds at set periods and for set amounts. Thus, issuing debt locks a company into providing fixed payments at set times in the future. This can be disadvantageous when a company experiences a temporary shortage of cash liquidity. In the worst case scenario, over-reliance on debt can cause a cash-flow crisis for a company, causing its lenders to call in their loans and forcing the company into bankruptcy.
On the other hand, equity, such as stock, is generally less risky than debt, from the issuing company's perspective. This is because stock does not require the issuing company to pay fixed amounts at fixed times. For example, stock dividends are typically payable at the company's exclusive option. Thus, although equity is generally not tax deductible, it has its place in raising capital for a company because it is more forgiving of a company suffering temporary cash shortages. In practice, most companies choose to raise capital by issuing both debt and equity.
From an investor's perspective, equity is more risky than debt. As explained above, debt pays out at fixed times and in fixed amounts. Unless the issuing company goes bankrupt, it must pay on its issued debt (and sometimes a company must pay on its debt even though it has declared bankruptcy). On the other hand, with the increased risk (to the investor) of equity comes the potential for increased rewards (again, to the investor). Stocks prices are not capped; indeed, stock prices can radically increase, and the issuing company can pay dividends. Thus, an investor can potentially receive much greater return on investment when investing in equity as compared to debt. Of course, the same investor runs the risk that equity can greatly diminish in value; this risk is much greater for equity than it is for debt.